package com.cheryjb.examples.gwt.clock.client;

import com.google.gwt.canvas.dom.client.Context2d;
import com.google.gwt.dom.client.ImageElement;
import com.google.gwt.user.client.ui.Image;

/**
 * Clock Frame Drawable Object
 * 
 * @author Jean-Baptiste Chery
 * 
 */
public class ClockFrame extends ADrawableObject {

	/**
	 * Clock Frame Image URL
	 */
	private static final String FRAME_IMAGE = "clock_frame.png";

	/**
	 * Clock Frame image
	 */
	private final ImageElement image;

	/**
	 * Create the ClockFrame object and init its position.
	 * 
	 * @param position
	 *            coordinates x,y where the image's top left corner will be
	 *            initiated
	 */
	public ClockFrame(final Vector position) {
		super(position);
		image = new Image(FRAME_IMAGE).getElement().cast();
	}

	@Override
	public void drawShapes(final Context2d context) {
		// as we use super class translation to move the object, image is always
		// drawn at (0,0)
		context.drawImage(image, 0, 0);
	}

}
